<?php 
namespace addons\prl\model;
use app\admin\model\prl\Articles as ArticlesModel;

/**
 * 
 */
class Articles extends ArticlesModel
{

	protected function scopeNomal($q)
	{
		$q->where('status', 1)->where('display', 1);
	}

	protected function scopeArticlesorder($q)
	{
		$q->order('weigh desc,releasetime desc')->field('content', true);
	}

	/** 获取上一条文章 栏目id 文章id */
	protected function scopePre($q, $c_id, $a_id)
	{
		$q->where('id','>',$a_id)->where('channels_id', $c_id)->order('weigh,releasetime')->field('id,title');
	}

	/** 获取下一条文章 栏目id 文章id */
	protected function scopeNext($q, $c_id, $a_id)
	{
		$q->where('id','<',$a_id)->where('channels_id', $c_id)->order('weigh desc,releasetime desc')->field('id,title');
	}
}